/****************************************************************************************
**  File: Segment3.hpp
**  Author: Asteroth
**  Date: 8-mag-2009
****************************************************************************************/

#ifndef __SEGMENT3_HPP__
#define __SEGMENT3_HPP__

template <typename T>
class Segment3x {
public:
	Vector3x<T> A, B;

	Segment3x():														A(0, 0, 0), B(0, 0, 0) {}
	Segment3x(const Segment3x<T> &segm):								A(segm.A), B(segm.B) {}
	Segment3x(const Vector3x<T> &pointA, const Vector3x<T> &pointB):	A(pointA), B(pointB) {}
	Segment3x(T aX, T aY, T aZ, T bX, T bY, T bZ):						A(aX, aY, aZ), A(bX, bY, bZ) {}

	/// Distance between point A and B.
	inline T length() const {
		T x = A.X - B.X;
		T y = A.Y - B.Y;
		T z = A.Z - B.Z;
		return sqrt(x*x + y*y + z*z);
	}
};

typedef Segment3x<float> Segment3;

#endif
